#ifndef __LIST_H__
    #define __LIST_H__

        //constants
        extern int DEBUG;

        //includes
        #include <iostream>
        #include <string>
        #include <fstream>
        #include <sstream>
        #include "string.h"
        #include "node.h"
        #include "sort.h"

        #define DELIMITER ','

        using namespace std;

        //list class define
        class list {
            public:
                list();                         //constructor
                ~list();                        //destructor

                void print();                    //print the entire list
                struct item* add(char* str);    //add item to the list
                int remove(item* wDelete);      //delete item from list
                void sort();                     //sort the list alphabetically
                int purgeclones();              //removes double entries from list
                void resetCursor(){wCurrent = wRoot;}   //resets current item pointer

                int getLength(){return len;}    //get length of list
                int count(void);                //calc length of list
                struct item* getRoot(){return wRoot;}   //get root of list
                void writedata(fstream& dest);   //compose write data
                string getPrompt(int direction);

            private:
                struct item* findLast();        //find last item in list
                struct item* findFree();        //find first free item in list
                struct item* allocate();        //allocate space for new item
                int itemPopulate(char* str);    //populate current item with string str
                void printItem(item* wPrint);   //print single item wPrint

                item* wRoot;                    //root item pointer
                item* wCurrent;                 //current item pointer
                int len;                        //length of list
                int curpos;

        };

#endif // __LIST_H__
